package com.shmn.gongjiajumain.controller;

import java.util.Arrays;
import java.util.Map;

//import org.apache.shiro.authz.annotation.RequiresPermissions;
import com.shmn.gongjiajumain.vo.outgoing.OutGoingJigFormVo;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import com.shmn.gongjiajumain.entity.OutgoingJigEntity;
import com.shmn.gongjiajumain.service.OutgoingJigService;
import com.shmn.common.utils.PageUtils;
import com.shmn.common.utils.R;



/**
 * 记录出库后的工夹具信息
 *
 * @author chenshun
 * @email 1005074582@qq.com
 * @date 2023-05-14 16:40:27
 */
@RestController
@RequestMapping("gongjiajumain/outgoingjig")
public class OutgoingJigController {
    @Autowired
    private OutgoingJigService outgoingJigService;

    @PostMapping("/list1")
    //@RequiresPermissions("gongjiajumain:outgoingjig:list")
    public R list1(@RequestBody OutGoingJigFormVo outGoingJigFormVo){
        PageUtils page = outgoingJigService.queryPage1(outGoingJigFormVo);

        return R.ok().put("page", page);
    }

    /**
     * 列表
     */
    @RequestMapping("/list")
    //@RequiresPermissions("gongjiajumain:outgoingjig:list")
    public R list(@RequestParam Map<String, Object> params){
        PageUtils page = outgoingJigService.queryPage(params);

        return R.ok().put("page", page);
    }


    /**
     * 信息
     */
    @RequestMapping("/info/{id}")
    //@RequiresPermissions("gongjiajumain:outgoingjig:info")
    public R info(@PathVariable("id") Integer id){
		OutgoingJigEntity outgoingJig = outgoingJigService.getById(id);

        return R.ok().put("outgoingJig", outgoingJig);
    }

    /**
     * 保存
     */
    @RequestMapping("/save")
    //@RequiresPermissions("gongjiajumain:outgoingjig:save")
    public R save(@RequestBody OutgoingJigEntity outgoingJig){
		outgoingJigService.save(outgoingJig);

        return R.ok();
    }

    /**
     * 修改
     */
    @RequestMapping("/update")
    //@RequiresPermissions("gongjiajumain:outgoingjig:update")
    public R update(@RequestBody OutgoingJigEntity outgoingJig){
		outgoingJigService.updateById(outgoingJig);

        return R.ok();
    }

    /**
     * 删除
     */
    @RequestMapping("/delete")
    //@RequiresPermissions("gongjiajumain:outgoingjig:delete")
    public R delete(@RequestBody Integer[] ids){
		outgoingJigService.removeByIds(Arrays.asList(ids));

        return R.ok();
    }

}
